<%@ page language="java" contentType="application/ms-word;charset=UTF-8"%>
<%@ page import="com.is.control.*" %>
<%@ page import="com.is.model.*" %>
<%@page import="com.is.util.ParamUtil"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="com.is.util.DesData"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>  
<head>
<style>
	table{border-collapse:collapse;border-spacing:0;border:1px; border-padding:0; width:600px; margin:0px auto;}
	.title{width:600px; margin:0px auto;text-align:center; font-size:24px;}
	table td{text-align:center; border:1px solid #000; height:22px;}
	caption{font-size:24px; text-align:center; line-height:10px; font-weight:bold;}
	body{font-size:12px}
</style>
<script type="text/javascript">
	window.onload = function(){
		var page = document.getElementById("pages");
		var h = page.clientHeight;
		if(h<920){
			page.style.height = "920";
		} else{
			page.style.height = "1840";
		}
	}
</script>
<title>Insert title here</title>
</head>
<body>
<% 
	User cu =(User)session.getAttribute("user"); 
	request.setCharacterEncoding("UTF-8");
	String stu = ParamUtil.getString(request,"stu");
	DesData des = new DesData();
	int sid =Integer.parseInt(des.decrypt(stu));
	
	Student s = new Student();
	s = StudentControl.getStudent(sid);
	String[] myStuyears = ParamClassControl.getMyStuyearsByClassId(s.getClassId());
	String defaultPicUrl="../../resources/image/man.GIF";
	String path = "../../User/UserHeadImage/";
	
	String fileName = "学生信息文档("+s.getChineseName()+").doc";  
   //对中文文件名编码  
  //fileName = URLEncoder.encode(fileName, "utf-8");  
   byte[] yte = fileName.getBytes("GB2312");  
   String unicoStr = new String(yte, "ISO-8859-1");
   response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);  
	
	String appName = ((HttpServletRequest) request).getContextPath();
    String http = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/";
   // System.out.println(appName);
    //System.out.println(http);
	if(sid>0){
%>
<!--startprint-->
	<div class="page">
	<p class='title'>东北师范大学外国留学生预科部学籍表</p>
	<table class="table" border='1' class="table">
			<th style="font-size:20px; text-align:center; line-height:10px; font-weight:bold;border:1px solid #000;" colspan="5">学生信息&nbsp;&nbsp;&nbsp;Information</th>
			<tbody>
				<tr>
					<td>护照用名<br/>Passport Name</td>
					<td colspan='2'><%=s.getPassportName() %></td>
					<td>中文姓名<br/>Chinese Name</td>
					<td><%=s.getChineseName() %></td>
				</tr>
				<tr>
					<td>国籍</td>
					<td><%=s.getNationality() %></td>
					<td rowspan='2'>性别<br/>Sex</td>
					<td rowspan='2'>
					<%=(s.getSex().equals("1"))?"男":"女" %>
					</td>
					<td colspan='1' rowspan='6'>
						<img id="imgs" alt="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;照片&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" src="<%=http+s.getPicPath() %>" width='150' height='150'/> 
					</td>
				</tr>
				<tr>
					<td>Nationality</td>
					<td><%=s.getNationalityEn() %></td>
				</tr>
				<tr>
					<td>出生日期<br/>Date of Birth</td>
					<td><%=s.getBirthday() %></td>
					<td>班级<br/>Class</td>
					<%System.out.print(s.getClassId());%>
					<td><%=ParamClassControl.getClassName(Integer.parseInt(s.getClassId()))%>
					 <%System.out.print(s.getClassId());%>
					</td>
				</tr>
				<tr>
					<td>护照号码<br/>Passport Number</td>
					<td><%=s.getPassportNumber() %></td>
					<td>CSC 号</td>
					<td><%=s.getCscNumber() %></td>
				</tr>
				<tr>
					<td>经费办法<br/>Type of Scholarship</td>
					<td><%=s.getScholarshipType() %></td>
					<td>类别<br/>Level</td>
					<td><%=s.getLevel() %></td>
				</tr>
				<tr>
					<td>专业院校<br/>University</td>
					<td><%=s.getUniversity() %></td>
					<td>专业<br/>Major</td>
					<td colspan='1'><%=s.getMajor() %></td>
				</tr>
				<tr>
					<td>学习时间<br/>Duration of Study</td>
					<td colspan="4">
						<%=s.getDuration() %>
					</td>
				</tr>
				<tr>
					<td>
					其他
					</td>
					<td >
						<%=s.getType() %>
					</td>
					<td>
						备注
					</td>
					<td colspan="2">
						<%=s.getTip() %>
					</td>
				</tr>
			</tbody>
			</table>
			<br/>
			<table class="table">
				<caption>成绩单  Transcript</caption>
			
				<%
				 if(myStuyears!=null&&myStuyears.length>0){
				   for(String stuyear:myStuyears){
					   System.out.print(s.getClassId());
				       if(stuyear!=null&&!stuyear.equals("")){
					   int stuyearId= Integer.parseInt(stuyear);
					   
				%>
				<tr>
					<td colspan="9"><%=ParamStuyearControl.getStuyear(stuyearId).getStuyear()%></td>
				</tr>
				<tr>
					<td rowspan="2" colspan="2">课程名称<br/> Course Type</td>
					<td rowspan="2">总课时<br/> Total Classes</td>
					<td rowspan="2">总缺勤数<br/>Total  Absence</td>
					<td rowspan="1" colspan="3">成绩<br/>  Score</td>
					<td rowspan="2">总成绩<br/> Total Score</td>
					<td rowspan="2">教师<br/>  Teacher</td>
				</tr>
				<tr>
					<td>平时<br/>Daily</td>
					<td>期中<br/>Midterm</td>
					<td>期末<br/>Final</td>
				</tr>
				<%
				 List<CourseClass> uccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(Integer.parseInt(s.getClassId()),stuyearId);
				 System.out.print("YYYYYYYYYYYY"+stuyearId);
				for(CourseClass cc:uccs){
					CourseScore cs = CourseScoreControl.getCSByStuIdAndCourseId(cc.getId(),s.getId());
				%>
				<tr>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName() %></td>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseNameEn() %></td>
					<td><%= AttendanceTimeControl.getCount(cc.getId(),stuyearId,"","")*2 %></td>
					<td><%=AttendanceDetailControl.getTotalQQByStuIdAndCourseClassIdAndStuyearId(sid,cc.getId(),stuyearId) %></td>
					<%if(cs!=null){%>
					<td><%=cs.getDailyScore() %></td>
					<td><%=cs.getMidtermScore() %></td>
					<td><%=cs.getFinalScore() %></td>
					<td><%=cs.getTotalScore()%></td>
					<%}else{%>
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
				   <%}
				   String tName = UserControl.getUserById(cc.getUid()).getName();
				   %>
					<td><%=(tName==null||tName.equals("null"))?"":tName %></td>
				</tr>
				<%
				  }
				       }
				}
				}else{
					out.print("<tr><td>暂无记录</td></tr>");
				}%>
				
			</table>
			</div>
			<%
			Evaluation ce = EvaluationControl.getEvaluationByStuyearAndStuId(sid,ParamStuyearControl.getCurrentStuyearId());
			%>
			<div class="pages">
			<table class="table">
				<caption>HSK</caption>
				<tr style="height:44px;">
					<td width="33%">级别</td>
					<td width="33%">Level</td>
					<td><%out.print((ce!=null)?ce.getLevel():"");%></td>
				</tr>
				<tr  style="height:44px;">
					<td>成绩</td>
					<td>Score</td>
					<td><%out.print((ce!=null)?ce.getScore():"");%></td>
				</tr>
			</table><br/>
			<table class="table">
				<caption>学生评定 Evaluation</caption>
				<tr>
					<td width="50%">教师评语</td>
					<td>Teachers’ Comments</td>
				</tr>
				<tr  style="height:160px;">
					<td colspan = "2">
						<p><%out.print((ce!=null)?ce.getComments():"");%></p>
					</td>
				</tr>
				<tr style="height:50px;">
					
					<td colspan = "2" style="text-align:right;">班主任（签章）:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td>奖惩记录</td>
					<td>Records of Rewards and Punishments</td>
				</tr>
				<tr  style="height:160px;">
					<td colspan = "2">
						<p><%out.print(ce!=null?ce.getRecords():"未找到相关数据");%></p>
					</td>
				</tr>
				<tr style="height:50px;">
					<td colspan = "2" style="text-align:right;">办公室负责人（签章）:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</tr>
				<tr style="height:50px;">
					<td>
						主管（签章）：
					</td>
					<td>
						东北师范大学外国留学生预科部<br/>&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;月&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日
					</td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
				<caption>外国留学人员来华签证申请表<br/>Visa Application for Study in China</caption>
				<tr>
					<td ><img height='824' width='590' src="<%=http+s.getVisaApplicationPath() %>" /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>录取通知书&nbsp;Admission notice</caption>
				<tr>
					<td ><img  height='824' width='590'  src="<%=http+s.getAdmissionPath() %>"  /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>护照&nbsp;Passport</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=http+s.getPassportPath() %>"  /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>中华人民共和国签证&nbsp;Chinese Visa</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=http+s.getChineseVisaPath() %>" /></td>
				</tr>
			</table>
			</div>
			<%}else{
				  out.print("抱歉未能额找到您查找的学生信息");
			} %>
<!--endprint-->
</body>
</html>